<%@ page import="com.edu.dreams.entity.User"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	User user = (User) request.getSession().getAttribute("user");
%>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>童话世界</title>
<meta name="description" content="一个充满童话世界的地方，带你回味童年." />
<meta name="keywords" content="童话、英雄和魔法" />
<link rel="shortcut icon" href="images/favicon.ico" />
<!-- 引入bootstrap 样式文件 -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- 引入我们自己的样式文件 -->
<link rel="stylesheet" type="text/css" href="css/default.css">
<link rel="stylesheet" href="css/animation.css">
<!-- 先引入jquery js文件 -->
<script src="js/jquery-3.5.1.min.js"></script>
<script src="js/pinterest_grid.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">
	$(function() {
		$("#gallery-wrapper").pinterest_grid({
			no_columns : 3,
			padding_x : 10,
			padding_y : 10,
			margin_bottom : 50,
			single_column_breakpoint : 700
		});

	});
</script>
<!--[if lt IE 9]>
    <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
<!--[if IE]>
    <script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
    <![endif]-->
</head>

<body>

	<!-- 导航栏 -->
	<nav class="navbar navbar-default">
		<div class="container">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed"
					data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
					aria-expanded="false">
					<span class="sr-only">Toggle navigation</span> <span
						class="icon-bar"></span> <span class="icon-bar"></span> <span
						class="icon-bar"></span>
				</button>
				<a class="navbar-brand"
					href="${pageContext.request.contextPath}/home"><img
					style="margin-left: 15px;" src="images/logo.jpg" alt="童话世界"></a>
			</div>

			<div class="collapse navbar-collapse"
				id="bs-example-navbar-collapse-1">
				<ul class="nav navbar-nav">
					<li><a href="${pageContext.request.contextPath}/home">首页 <span
							class="sr-only">(current)</span></a></li>
					<li class="active"><a href="${pageContext.request.contextPath}/animations">动画</a></li>
					<li><a
						href="${pageContext.request.contextPath}/news">资讯</a></li>
					<li><a href="${pageContext.request.contextPath}/rank">排行榜</a></li>
					<li><a href="${pageContext.request.contextPath}/personal">个人中心</a></li>
				</ul>
				<form action="${pageContext.request.contextPath}/searchAnim"
					method="post" class="navbar-form navbar-left">
					<div class="form-group">
						<input type="text" name="animname" class="form-control"
							placeholder="搜索动画">
					</div>
					<button type="submit" class="btn btn-default">搜索</button>
				</form>
				<ul class="nav navbar-nav navbar-right">
					<li><a href="${pageContext.request.contextPath}/personal"><%=user.getUser_name()%> </a></li>
					<li><a href="${pageContext.request.contextPath}/logout">退出登录</a></li>
				</ul>
			</div>
			<!-- /.navbar-collapse -->
		</div>
		<!-- /.container-fluid -->
	</nav>

	<div class="container">
		<div class="row">
			<img class="img-responsive" src="images/bg3.jpg" alt="童话世界">
		</div>
	</div>


	<!--主体内容-->
	<h1 style="text-align: center; margin-bottom: 60px;">热播中</h1>
	<!-- 轮播图 -->
	<div class="container">
		<div id="carousel-example-generic" class="carousel slide"
			data-ride="carousel">
			<!-- 轮播标志小圆点 -->
			<ol class="carousel-indicators">
				<li data-target="#carousel-example-generic" data-slide-to="0"
					class="active"></li>
				<li data-target="#carousel-example-generic" data-slide-to="1"></li>
				<li data-target="#carousel-example-generic" data-slide-to="2"></li>
			</ol>

			<!-- 图片 -->
			<div class="carousel-inner" role="listbox">
				<c:forEach var="item" begin="0" end="2" items="${animdatas}"
					varStatus="status">
					<c:choose>
						<c:when test="${status.first}">
							<div class="item active">
								<a
									href="${pageContext.request.contextPath}/animationshow?id=${item.anim_id}">
									<img
									src="${pageContext.request.contextPath}/upload/${item.anim_picurl}"
									alt="${item.anim_name}">
								</a>
								<div class="carousel-caption">${item.anim_name}</div>
							</div>
						</c:when>
						<c:otherwise>
							<div class="item">
								<a
									href="${pageContext.request.contextPath}/animationshow?id=${item.anim_id}">
									<img
									src="${pageContext.request.contextPath}/upload/${item.anim_picurl}"
									alt="${item.anim_name}">
								</a>
								<div class="carousel-caption">${item.anim_name}</div>
							</div>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</div>

			<!-- 左右按钮 -->
			<a class="left carousel-control" href="#carousel-example-generic"
				role="button" data-slide="prev"> <span
				class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
				<span class="sr-only">上一张</span>
			</a> <a class="right carousel-control" href="#carousel-example-generic"
				role="button" data-slide="next"> <span
				class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
				<span class="sr-only">下一张</span>
			</a>
		</div>
	</div>

	<h1 style="text-align: center;">新番表</h1>
	<div class="container">
		<section id="gallery-wrapper">
			<c:forEach var="item" begin="0" end="5" items="${animdatas}">
				<article class="white-panel">
					<a
						href="${pageContext.request.contextPath}/animationshow?id=${item.anim_id}"><img
						src="${pageContext.request.contextPath}/upload/${item.anim_picurl}"
						class="thumb"></a>
					<h1>
						<a
							href="${pageContext.request.contextPath}/animationshow?id=${item.anim_id}">${item.anim_name}</a>
					</h1>
					<p>${item.anim_jieshao.length()>100?item.anim_jieshao.substring(0,100):item.anim_jieshao}...</p>
				</article>
			</c:forEach>
		</section>
	</div>

	<!-- 页面尾部 -->
	<div class="footer container">
		<hr>
		<p class="text-center">2020-forever</p>
	</div>

</body>

</html>